package com.zpark.controller;

import com.zpark.mapper.IRankingMapper;
import com.zpark.pojo.Ranking;
import com.zpark.service.IRankingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 微服务的调用同意采用restform风格，返回的格式是json格式
 */
@RestController
@RequestMapping("/service")
public class RankingController {

    // 注入业务层
    @Autowired
    private IRankingService rankingService;

    @PostMapping("/all")
    public List<Ranking> findAll(){
        return rankingService.findAll();
    }

    @GetMapping("/find_id/{id}")
    public Ranking findById(@PathVariable Integer id){ // 从路径里去获取这个id
        return rankingService.findById(id);
    }

}
